<!-- 表单系统图 -->

<template>
  <div>
    <MajorTitle :title="one.deviceName" />

    <draggable v-model="one.deviceGraphDto" :animation="200" draggable=".IOTList-GraphItem">
      <GraphItem v-for="item in one.deviceGraphDto" :key="item.time || item.id" :obj="item" class="IOTList-GraphItem" />

      <GraphAdd v-if="hasAdd" class="IOTList-GraphAdd" />
    </draggable>
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'FormGraph',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb()],

  /**
   * 组件导入 (Abc.vue + Abc/index.vue)
   */
  ...CORE.components(require.context('./', true, /vue$/)),

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    /**
     * 计算
     */
    hasAdd() {
      return this.one.deviceGraphDto.length < 10
    },
  },
}
</script>

<style lang="scss">
@import './index.scss';
</style>
